-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1788 incorrect url_for for routes with hosts, added tests. #1789
Conversation
@Tronic gonna get this in ASAP - can you leave the branch up after merge, I think this needs to go in to 19.12 LTS which I'm still trying to fix. Thx! |
Codecov Report
@@ Coverage Diff @@
## master #1789 +/- ##
=========================================
+ Coverage 92.08% 92.1% +0.01%
=========================================
Files 23 23
Lines 2312 2317 +5
Branches 426 427 +1
=========================================
+ Hits 2129 2134 +5
Misses 141 141
Partials 42 42
Continue to review full report at Codecov.
|
I cannot reproduce that test failure on my own system, and it is not quite obvious from the output what went wrong. Is this related to this patch or a problem with the CI pipeline? |
@Tronic test failure is py38 on windows. It's included for forward compat but it's not required because windows is best-effort support. You're golden. |
Includes commits from: sanic-org#1762 sanic-org#1764 sanic-org#1789
* Cherry pick PRs to backport to 19.12LTS Includes commits from: #1762 #1764 #1789 * Fix type annotation issue; run black and isort * Update Makefile Co-authored-by: Ashley Sommer <[email protected]>
The router allows specifying different hostname for specific routes, and handles this internally by string concatenation of host and path into uri, confusing
app.url_for
into creating invalid URLs.Ultimately it would be more sensible to keep URL and path separately in Router objects, but as a workaround to the mentioned bug report, this is now handled in
url_for
which uses any route-provided host whereSERVER_NAME
would otherwise be used.Adds
test_url_for.py
to avoid regressions, and to allow for more comprehensive testing of the said function, which doesn't seem to be currently tested properly.Fixes issue #1788